home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 717 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: inforamp.net!usenet
  2. From: pcurran@inforamp.net (Peter Curran)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Restrictions on qsort compare function?
  5. Date: Tue, 09 Apr 1996 23:25:49 GMT
  6. Organization: PSC Enterprises
  7. Message-ID: <4kerk9$7ta@sam.inforamp.net>
  8. References: <4iokop$h4p@lyra.csx.cam.ac.uk> <4iqjar$2m9@usenet.pa.dec.com> <4jgltp$f9l@lyra.csx.cam.ac.uk> <828644274snz@genesis.demon.co.uk> <4k28t4$2g0@sam.inforamp.net> <828726582snz@genesis.demon.co.uk> <4k69bf$ehg@sam.inforamp.net> <828971813snz@genesis.demon.co.uk> <4kbl1l$74r@sam.inforamp.net> <9livf9cusp.fsf@marks.jyacc.com>
  9. Reply-To: pcurran@inforamp.net
  10. NNTP-Posting-Host: ts37-13.tor.istar.ca
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. On Tue, 9 Apr 1996 14:54:14 GMT in article <9livf9cusp.fsf@marks.jyacc.com>
  14.     jtrigg@marks.jyacc.com (Jim Trigg) (Jim Trigg) wrote:
  15.  
  16. >So what happens if the array is large enough that qsort takes longer
  17. >than a second to complete?  The return values from the comparison
  18. >function are no longer consistent.  Is the compiler vendor then
  19. >obligated to produce an implementation of qsort that will complete a
  20. >sort in a constant amount of time?  That is what breaks your
  21. >comparison function.
  22.  
  23. AARRRGGHHH!!  I presume you have just started reading this thread!  (BTW,
  24. completing in half a second won't solve the problem if it happens to start a
  25. quarter of a second before time() changes.)
  26.  
  27. I will not post any more on this, but I can't leave it like this.  That is the
  28. WHOLE POINT of my hypothesized comparison function!!!  To summarize:
  29.  
  30. I defined when I consider a value to be less than/equal to/greater than another,
  31. and wrote a comparison function that implements this definition.  The function
  32. is completely consistent with this definition.  Whenever it is invoked, it will
  33. return the appropriate and correct value.  This is what the standard requires me
  34. to do, and I have done it.  Any problems should now lie with qsort().  The
  35. standard represents a contract between users and implementors of C.  I have
  36. fulfillled my side of the bargain as a user - now it is the implementor's turn.
  37.  
  38. This, of course, is unreasonable.  I, of course, completely understand that it
  39. is virtually impossible to implement such a qsort().  However, IMHO, the
  40. standard as written requires it, and so the standard should be fixed - someday
  41. when The Committee has nothing better to do.
  42.  
  43. --
  44. Peter Curran                               pcurran@inforamp.net
  45.  
  46.